﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="HPIT_Library.Ajax.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="../js/jquery-1.7.2.min.js"></script>
    <script>
        $(function () {
            $("#Button1").click(function () {
                //$.ajax({
                //    type: "POST",
                //    url: "/Ajax/Handler1.ashx",
                //    data: "",
                //    success: function (msg) {
                //        //alert(msg);
                //        $("#div").html(msg)
                //    }
                //});
               
                var Name = $("#TextBox1").val();
                //get请求
                $.get("/Ajax/Handler1.ashx", {"MyName":Name}, function (msg) {
                    $("#div").html(msg)
                });
                //post请求
                //$.post("/Ajax/Handler1.ashx", { "MyName": Name }, function (msg) {
                //    $("#div").html(msg)
                //});
            })
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <input id="Button1" type="button" value="button" />
        </div>
        <div id="div" style="color:red"></div>
    </form>
</body>
</html>
